# Create your views here.
import facebook

from drivertest.questions import views
from django.shortcuts import render_to_response


def start_test(request):
    random_questions = views.get_random()
    name = request.facebook.users.getInfo([request.facebook.uid], ['first_name'])[0]['first_name']

    return render_to_response('canvas.fbml', locals())

    #return render_to_response('index.html', locals())
    

def update_profile(request):
    fbml = "<fb:wide><fb:subtitle>Driver Testification</fb:subtitle>"
    fbml += "<fb:if-is-own-profile>This is your profile.<fb:else>This is not your profile.</fb:else></fb:if-is-own-profile></fb:wide>"

    request.facebook.profile.setFBML(fbml, [request.facebook.uid])

    return HttpResponseRedirect(request.facebook.get_url('profile'))

